import java.util.Scanner;

public class code {
    public static void main(String [] args) {
        //输入
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int []f = new int [n];
        int max = 0, min = Integer.MAX_VALUE, absmax = 0;
        for(int i=0;i<n;i++) {
            f[i] = s.nextInt();
        }
        //求max和min
        for(int i=0;i<n;i++) {
            max = Math.max(f[i], max);
            min = Math.min(f[i], min);
        }
        //求absmax
        for(int i=0;i<n;i++) {
            for(int j=0;j<n;j++) {
                if(i==j) continue;
                absmax = Math.max(Math.abs(f[i]-f[j]), absmax);
            }
        }
        //输出
        System.out.print(max+" "+min+" "+absmax);

    }
}
